#include "SpriteFood.h"
#include "CGlobal.h"
using namespace cocos2d;
SpriteFood::SpriteFood(void)
{
}

SpriteFood::~SpriteFood(void)
{
}

bool SpriteFood::init(const std::string arrayPic[],int nNum,bool bRepeat/*=true*/)
{
	if (!CAnimationSprite::init(arrayPic,nNum,bRepeat))
	{
		return false;
	}
	CCSprite *pPic=CGlobal::SpriteWithFile(arrayPic[0].c_str());
	if (pPic)
	{
		size_=pPic->getContentSize();
	}
	return true;
}

SpriteFood * SpriteFood::node(const std::string arrayPic[],int nNum,bool bRepeat/*=true*/)
{
	SpriteFood *pFood=new SpriteFood;
	if (pFood)
	{
		pFood->autorelease();
		if (pFood->init(arrayPic,nNum,bRepeat))
		{
			return pFood;
		}
	}
	return NULL;
}

cocos2d::CCSize SpriteFood::getSize()
{
	return size_;
}

